Compiled Native Interface
   HOME

TheInfoList



OR:

The GNU Compiler for Java (GCJ) is a discontinued free
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
for the
Java programming language Java is a high-level, general-purpose, memory-safe, object-oriented programming language. It is intended to let programmers ''write once, run anywhere'' ( WORA), meaning that compiled Java code can run on all platforms that support Jav ...
. It was part of the
GNU Compiler Collection The GNU Compiler Collection (GCC) is a collection of compilers from the GNU Project that support various programming languages, Computer architecture, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes ...
. GCJ compiles Java
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
to
Java virtual machine A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally descr ...
(JVM)
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
or to
machine code In computer programming, machine code is computer code consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). For conventional binary computers, machine code is the binaryOn nonb ...
for a number of
CPU architecture In computer science and computer engineering, computer architecture is a description of the structure of a computer system made from component parts. It can sometimes be a high-level description that ignores details of the implementation. At a mo ...
s. It could also compile class files and whole JARs that contain bytecode into machine code.


History

The GCJ runtime-libraries original source is from
GNU Classpath GNU Classpath is a free software implementation of the standard class library for the Java programming language. Most classes from J2SE 1.4 and 5.0 are implemented. Classpath can thus be used to run Java-based applications. GNU Classpath is a ...
project, but there is a code difference between the libgcj libraries. GCJ 4.3 uses the
Eclipse An eclipse is an astronomical event which occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three ...
Compiler for Java as a front-end. In 2007, a lot of work was done to implement support for Java's two graphical
API An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
s in
GNU Classpath GNU Classpath is a free software implementation of the standard class library for the Java programming language. Most classes from J2SE 1.4 and 5.0 are implemented. Classpath can thus be used to run Java-based applications. GNU Classpath is a ...
: AWT and Swing. Software support for AWT is still in development. "Once AWT support is working then Swing support can be considered. There is at least one free-software partial implementations of Swing that may be usable.". The GNU CLASSPATH was never completed to even Java 1.2 status and now appears to have been abandoned completely. As of 2015, there were no new developments announced from GCJ and the product was in
maintenance mode The meaning of maintenance mode depends on the context. In the world of software development, it refers to a point in a computer program's life when it has reached all of its goals and is generally considered to be "complete" and bug-free. The ...
, with open-source Java toolchain development mostly happening within
OpenJDK OpenJDK (Open Java Development Kit) is a free and open-source implementation of the Java Platform, Standard Edition (Java SE). It is the result of an effort Sun Microsystems began in 2006, four years before the company was acquired by Oracle Corp ...
. GCJ was removed from the GCC trunk on September 30, 2016. Announcement of its removal was made with the release of the GCC 7.1, which does not contain it. GCJ remains part of GCC 6.


Performance

The compilation function in GCJ should have a faster start-up time than the equivalent bytecode launched in a JVM when compiling Java code into machine code.


Compiled Native Interface (CNI)

The Compiled Native Interface (CNI), previously named "Cygnus Native Interface", is a
software framework In computer programming, a software framework is a software abstraction that provides generic functionality which developers can extend with custom code to create applications. It establishes a standard foundation for building and deploying soft ...
for the GCJ that allows Java code to
call Call or Calls may refer to: Arts, entertainment, and media Games * Call (poker), a bet matching an opponent's * Call, in the game of contract bridge, a bid, pass, double, or redouble in the bidding stage Music and dance * Call (band), from L ...
, and be called by, native applications (programs specific to a hardware and operating-system platform) and libraries written in C++. CNI closely resembles the JNI (Java Native Interface) framework which comes as a standard with various
Java virtual machine A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally descr ...
s.


Comparison of language use

The authors of CNI claim for various advantages over JNI: CNI depends on Java classes appearing as C++ classes. For example,The example comes from: https://gcc.gnu.org/onlinedocs/gcj/Objects-and-Classes.html#Objects-and-Classes given a Java class, public class Int one can use the class thus: #include #include Int *mult(Int *p, int k)


See also

*
Excelsior JET Excelsior JET is a now-defunct proprietary Java SE technology implementation built around an ahead-of-time (AOT) Java to native code compiler. The compiler transforms the portable Java bytecode into optimized executables for the desired hardware a ...
(Excelsior Java native code compiler) *
IcedTea IcedTea is a build and integration project for OpenJDK launched by Red Hat in June 2007. IcedTea also includes some addon libraries: IcedTea-Web is a free software implementation of Java Web Start and the Java web browser applet plugin. ...
*
Kaffe Kaffe is a discontinued " clean room design" (reverse engineering) version of a Java Virtual Machine. It comes with a subset of the Java Platform, Standard Edition (Java SE), Java API, and tools needed to provide a Java runtime environment. Like m ...
*
SableVM SableVM was a clean room implementation of Java bytecode interpreter implementing the Java virtual machine ( VM) specification, second edition. SableVM was designed to be a robust, extremely portable, efficient, and fully specifications-compliant ...
*
JamVM JamVM is an open-source Java Virtual Machine (JVM) developed to be extremely small compared with other virtual machines (VMs) while conforming to the Java virtual machine specification version 2 (blue book). JamVM can be configured to use the GNU ...
*
Apache Harmony Apache Harmony is a retired open source, free Java implementation, developed by the Apache Software Foundation. It was announced in early May 2005 and on October 25, 2006, the board of directors voted to make Apache Harmony a top-level projec ...
*
Jikes Jikes is an open-source Java compiler written in C++. It is no longer being updated. The original version was developed by David L. "Dave" Shields and Philippe Charles at IBM but was quickly transformed into an open-source project contributed ...
*
GraalVM GraalVM is a Java Development Kit (JDK) written in Java. The open-source distribution of GraalVM is based on OpenJDK, and the enterprise distribution is based on Oracle JDK. As well as just-in-time (JIT) compilation, GraalVM can compile a Java ...
- GraalVM's Native Image functionality is an ahead-of-time compilation technology that produces executable binaries of class files. *
Java virtual machine A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally descr ...
*
Free Java implementations Free Java implementations are software projects that implement Oracle's Java technologies and are distributed under free software licences, making them free software. Sun released most of its Java source code as free software in May 2007, so it ...
* Kotlin - Kotlin/Native is a technology for compiling Kotlin to native binaries that run without any JVM. It comprises a
LLVM LLVM, also called LLVM Core, is a target-independent optimizer and code generator. It can be used to develop a Compiler#Front end, frontend for any programming language and a Compiler#Back end, backend for any instruction set architecture. LLVM i ...
-based backend for the Kotlin compiler and a native implementation of the Kotlin runtime library.


References


External links

* * * * {{DEFAULTSORT:Gnu Compiler For Java Free and open source compilers
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
Java compilers Discontinued Java virtual machines